Use the following steps to configure Nginx in order to run the PCC Viewer samples. These steps assume an Ubuntu OS installation without Nginx installed:
- Install nginx:
sudo apt-get install nginx
- Install php-fpm
sudo apt-get install php5-fpm
- Edit /etc/nginx/sites-available/default and replace the PHP script location section with the configuration below. To help locate the PHP script location, look for the comment that starts like this: "# pass the PHP scripts to FastCGI server...". The first 'location' block enables PHP scripts to be executed. The second location block is needed to allow URLs with arguments following the script name to be properly parsed. Example of such a URL: http://domain.com/site/script.php/arg1/arg2/arg3. The PCC Viewer samples use URLs like these so this is a requirement for them to function properly.
Example |
Copy Code
|
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# The following is required by
location ~ .php($|/) {
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+.php)(/.+)") {
set $script $1;
set $path_info $2;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
# PathInfo adjustment
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param PATH_INFO $path_info;
# end
include fastcgi_params;
}
|
- Reload nginx:
sudo service nginx reload